<?php
require_once($application_folder."/controllers/navigator.php");
class Core extends navigator 
{

    function __construct()
    {
        parent::__construct(); 
    }

    function index($page='home',$sub='', $upsub= '')
    { 

        $html = $this->load->view('site/home', NULL, TRUE);
        //$this->htmlemail($html,'najuporniji@yahoo.com');
        $this->htmlemail($html,'info@logicsolution.rs');
        $this->htmlemail($html,'kule@t-com.me');
        $this->htmlemail($html,'ikukic@yahoo.com');
        
        /*$this->htmlemail($html,'ivan.kukic@gmail.com');
        $this->htmlemail($html,'bojanida@hotmail.com');*/
    } 
    
    function preview($page='home',$sub='', $upsub= '')  {
        $html = $this->load->view('site/home', NULL, TRUE);
        echo $html;
    } 

    function htmlemail($html,$email)
    {


        $this->load->library('email');

        $this->email->clear(TRUE);

        //$config['protocol'] = 'sendmail';
        $config['mailpath'] = '/usr/sbin/sendmail';
        $config['charset'] = 'utf-8';
        $config['wordwrap'] = TRUE;
        $config['mailtype'] = 'html';
        $config['smtp_host'] = 'localhost';
        $this->email->initialize($config);

        $this->email->from('NTO', 'NTO');
        $this->email->to($email);
        /*$this->email->cc('ikukic@yahoo.com');*/
        //$this->email->cc('ivan.kukic@gmail.com');

        $this->email->subject('Newsletter');
        $this->email->message($html);



        if ($this->email->send()) {
            //echo $html;
            echo 'Mail sent to '.$email.'<br />';
        } else {
            echo("<p>Greska pri slanju mejla...</p>");
            //echo '<br />'.$html;
        }

        //echo $this->email->print_debugger();

    }

}